package com.avcdata.aoscustommade.main;


import android.support.v4.app.Fragment;

/**
 * Created by c.c on 2017/2/26.
 * Fragment基类
 */
public abstract class BaseFragment extends Fragment {
    //当前状态是否可见
    protected boolean isVisible;
    @Override
    public void setUserVisibleHint(boolean isVisibleToUser) {
        super.setUserVisibleHint(isVisibleToUser);
        if (getUserVisibleHint()) {
            isVisible = true;
            onVisible();
        } else {
            isVisible = false;
            onInVisible();
        }
    }


    /**
     * 不可见
     */
    protected void onInVisible() {

    }

    /**
     * 可见
     */
    protected void onVisible() {
        lazyload();
    }

    /**
     * 延迟加载
     */
    protected abstract void lazyload();


}
